package org.neusoft.config;

import org.neusoft.Interceptor.AuthInterceptor;
import org.neusoft.Interceptor.WhiteList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;

/**
 * @AUTHOR 尹书岿
 * @DATE 2024/12/19 18:59
 * @DESCRIBE
 */
@Configuration
public class AuthInterceptorConfig {
    @Autowired
    private AuthInterceptor authInterceptor;

    @Autowired
    private WhiteList whiteList;
    public void addInterceptor(InterceptorRegistry registry){
        registry.addInterceptor(authInterceptor)
                .addPathPatterns(whiteList.getUrl())
                .excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**", "/error");
    }
}
